import { CSSProperties } from 'vue'
import { AnimateExecTimeConstType, AnimateClearTimeConstType } from '../../common'
import { VisibilityDetailPropsType } from '../SVisibilityDetail'
import {
  AnimateCssConst,
  AnimateCssNameConst,
  AnimateCssDelayConst,
  AnimateCssSpeedConst,
  AnimateCssRepeatConst
} from './consts'

export const AnimateCssConstType_Name = 'AnimateCssConstType'
export const AnimateCssNameConstType_Name = 'AnimateCssNameConstType'
export const AnimateCssDelayConstType_Name = 'AnimateCssDelayConstType'
export const AnimateCssSpeedConstType_Name = 'AnimateCssSpeedConstType'
export const AnimateCssRepeatConstType_Name = 'AnimateCssRepeatConstType'
export const AnimateCssPropsType_Name = 'AnimateCssPropsType'

export type AnimateCssConstType = (typeof AnimateCssConst)[keyof typeof AnimateCssConst]

export type AnimateCssNameConstType = (typeof AnimateCssNameConst)[keyof typeof AnimateCssNameConst]

export type AnimateCssDelayConstType =
  (typeof AnimateCssDelayConst)[keyof typeof AnimateCssDelayConst]

export type AnimateCssSpeedConstType =
  (typeof AnimateCssSpeedConst)[keyof typeof AnimateCssSpeedConst]

export type AnimateCssRepeatConstType =
  (typeof AnimateCssRepeatConst)[keyof typeof AnimateCssRepeatConst]

type VisibilityDetailPropsOmitType = Omit<
  VisibilityDetailPropsType,
  | 'beforeShow'
  | 'showed'
  | 'beforeHide'
  | 'hidden'
  | 'beforeShowNotScroll'
  | 'showedNotScroll'
  | 'hiddenNotScroll'
>

export type AnimateCssPropsType = {
  // 动画执行时机
  execTime?: AnimateExecTimeConstType
  // 动画样式类名名称
  animate?: AnimateCssConstType
  // 动画清除的时机
  clearTime?: AnimateClearTimeConstType[]
  // 动画执行延迟
  delay?: AnimateCssDelayConstType
  // 动画执行速度
  speed?: AnimateCssSpeedConstType
  // 动画执行重复次数
  repeat?: AnimateCssRepeatConstType
  // 样式类名
  className?: string
  // 样式
  style?: Partial<CSSProperties> | string
  // 组件完全显示之前执行动画的回调函数
  beforeShow?: () => void
  // 组件完全显示后执行动画的回调函数
  showed?: () => void
  // 组件完全隐藏之前执行动画的回调函数
  beforeHide?: () => void
  // 组件完全隐藏后的回调函数
  hidden?: () => void
  // 元素是否可视组件（SVisibilityDetail） Props
  visibilityDetailProps?: VisibilityDetailPropsOmitType
}
